package cn.iocoder.yudao.module.ad.controller.admin.legaladviceclueqa;

import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;

import cn.iocoder.yudao.module.ad.controller.admin.legaladviceclueqa.vo.*;
import cn.iocoder.yudao.module.ad.dal.dataobject.legaladviceclueqa.AdLegalAdviceClueQaDO;
import cn.iocoder.yudao.module.ad.service.legaladviceclueqa.AdLegalAdviceClueQaService;

@Tag(name = "管理后台 - 法律咨询线索对话")
@RestController
@RequestMapping("/ad/legal-advice-clue-qa")
@Validated
public class AdLegalAdviceClueQaController {

    @Resource
    private AdLegalAdviceClueQaService legalAdviceClueQaService;


    @GetMapping("/get")
    @Operation(summary = "获得法律咨询线索对话")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    @PreAuthorize("@ss.hasPermission('ad:legal-advice-clue:query')")
    public CommonResult<AdLegalAdviceClueQaRespVO> getLegalAdviceClueQa(@RequestParam("id") Long id) {
        AdLegalAdviceClueQaDO legalAdviceClueQa = legalAdviceClueQaService.getLegalAdviceClueQa(id);
        return success(BeanUtils.toBean(legalAdviceClueQa, AdLegalAdviceClueQaRespVO.class));
    }

    @GetMapping("/page")
    @Operation(summary = "获得法律咨询线索对话分页")
    @PreAuthorize("@ss.hasPermission('ad:legal-advice-clue:query')")
    public CommonResult<PageResult<AdLegalAdviceClueQaRespVO>> getLegalAdviceClueQaPage(@Valid AdLegalAdviceClueQaPageReqVO pageReqVO) {
        PageResult<AdLegalAdviceClueQaDO> pageResult = legalAdviceClueQaService.getLegalAdviceClueQaPage(pageReqVO);
        return success(BeanUtils.toBean(pageResult, AdLegalAdviceClueQaRespVO.class));
    }



}